package com.eastchina.fids2focs.common;

import java.util.ArrayList;
import java.util.List;

import org.codehaus.xfire.aegis.type.java5.IgnoreProperty;

public class FIDSIIErrors {

	/**
	 * <p>The List of FIDSIIError objects.</p>
	 */
	private List<FIDSIIError> errors;

	/**
	 * <p>Return the list of all errors </p>
	 * @return
	 */
	public List<FIDSIIError> getErrors() {
		return errors;
	}

	/**
	 * Adds the errors from the given list
	 * @param errors  The <code>FIDSIIError</code> object to be added
	 */
	public void addErrors(List<FIDSIIError> errors) {
		if (errors == null) {
			errors = new ArrayList<FIDSIIError>();
		}
		this.errors.addAll(errors);
	}
	
	/**
	 * Adds the error from the given <code>FIDSIIError</code> object
	 * @param error  The <code>FIDSIIError</code> object to be added
	 */
	public void addError(FIDSIIError error) {
		if (errors == null) {
			errors = new ArrayList<FIDSIIError>();
		}
		errors.add(error);
	}
	
    /**
     * <p>Return <code>true</code> if there are no errors recorded in this
     * collection, or <code>false</code> otherwise.</p>
     */
	@IgnoreProperty
	public boolean isEmpty() {
		return errors == null || errors.isEmpty();
	}
}
